package com.zyzd.general.module.managerlist;

import android.os.Bundle;

import com.zyzd.general.entity.local.ManagerListEntity;
import com.zyzd.retrofit.base.BaseRecyclerFragment;

/**
 * Created by lzy on 2018/5/15 0015.
 * description ${管理列表}
 */
public class ManagerListFragment extends BaseRecyclerFragment<ManagerListContract.IPresenter, ManagerListAdapter, ManagerListEntity> implements ManagerListContract.IView {

    public static final String EXTRA_DATA_TAG = "dataTag";

    public static ManagerListFragment getInstance(String dataTag) {
        ManagerListFragment managerListFragment = new ManagerListFragment();
        Bundle bundle = new Bundle();
        bundle.putString(EXTRA_DATA_TAG, dataTag);
        managerListFragment.setArguments(bundle);
        return managerListFragment;
    }

    @Override
    protected void initBundle(Bundle arguments) {
        super.initBundle(arguments);
        mPresenter.setDataTag(arguments.getString(EXTRA_DATA_TAG, ""));
    }

    @Override
    public ManagerListAdapter createAdapter() {
        return new ManagerListAdapter(getContext());
    }

    @Override
    protected ManagerListPresenter createPresenter() {
        return new ManagerListPresenter();
    }

    @Override
    public void onItemClick(int position) {
        ManagerListEntity item = mAdapter.getItem(position);
        addFragment(item.getContainerViewId(), item.getFragment(), item.getTag());
    }

    @Override
    public boolean isEnableLoadMore() {
        return false;
    }

    @Override
    public boolean isEnableRefresh() {
        return false;
    }
}
